<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    
<head>

    <script id="allmobilize" charset="utf-8" src="http://a.yunshipei.com/46aae4d1e2371e4aa769798941cef698/allmobilize.min.js"></script>
 <meta http-equiv="Cache-Control" content="no-siteapp" /><link rel="alternate" media="handheld" href="#" />

    <title>__sync_fetch_and_add系列的命令 - qiqll的专栏
        - 博客频道 - CSDN.NET</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="__sync_fetch_and_add系列的命令，发现这个系列命令讲的最好的一篇文章，英文好的同学可以直接去看原文。Multithreaded simple data type access and atomic variables&#160;&#160;&#160;&#160; __sync_fetch_and_add系列一共有十二个函数，有加/减/与/或/异或/等函数的原子性操作函数,__sync_fetch_and_add," />
    <script src="http://static.blog.csdn.net/scripts/jquery.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://static.blog.csdn.net/scripts/ad.js?v=1.1"></script>
        <!--new top-->
               <link rel="stylesheet" href="http://static.csdn.net/public/common/toolbar/css/index.css">        <!--new top-->

    <link rel="Stylesheet" type="text/css" href="http://static.blog.csdn.net/skin/default/css/style.css?v=1.1" />
    <link id="RSSLink" title="RSS" type="application/rss+xml" rel="alternate" href="/qiqll/rss/list" />
    <link rel="shortcut icon" href="http://csdnimg.cn/public/favicon.ico" />
    <link type="text/css" rel="stylesheet" href="http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/default.css" />
 


</head>
<body>
    
   
      <!--new top-->
    <script id="toolbar-tpl-scriptId" fixed="true" prod="blog" skin="black" src="http://static.csdn.net/public/common/toolbar/js/html.js" type="text/javascript"></script>
     <!--new top-->
    <div id="container">
        <div id="header">
    <div class="header">
        <div id="blog_title">
            <h2>
                <a href="http://blog.csdn.net/qiqll">qiqll的专栏</a></h2>
            <h3></h3>
            <div class="clear">
            </div>
        </div>
        <div class="clear">
        </div>
    </div>
</div>
<div id="navigator">
    <div class="navigator_bg">
    </div>
    <div class="navigator">
        <ul>
                <li id="btnContents"><a href="http://blog.csdn.net/qiqll?viewmode=contents"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_mulu'])">
                    <img src="http://static.blog.csdn.net/images/ico_list.gif">目录视图</span></a></li>
                <li id="btnView"><a href="http://blog.csdn.net/qiqll?viewmode=list"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_zhaiyao'])">
                    <img src="http://static.blog.csdn.net/images/ico_summary.gif">摘要视图</span></a></li>
                <li id="btnRss"><a href="http://blog.csdn.net/qiqll/rss/list"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_RSS'])">
                    <img src="http://static.blog.csdn.net/images/ico_rss.gif">订阅</span></a></li>                

            </ul>
    </div>
</div>
<script type="text/javascript">
    var username = "qiqll";
    var _blogger = username;
    var blog_address = "http://blog.csdn.net/qiqll";
    var static_host = "http://static.blog.csdn.net";
    var currentUserName = "";  
</script>

        <div id="body">
            <div id="main">
                <div class="main">
                        <div class="ad_class">
<div class="notice tracking-ad" data-mod='popu_3' > 

<a href="http://bbs.csdn.net/topics/390812950?page=5"target="_blank">
<font color=blue>博客专家福利
</font></a>
&nbsp;&nbsp;&nbsp;

<a href="http://blog.csdn.net/csdnproduct/article/details/40181275">
<font color=red>公告：CSDN博客积分系统升级</font></a>

&nbsp;&nbsp;&nbsp;&nbsp;

<a href="http://blog.csdn.net/blogdevteam/article/details/40047403">
<font color=blue>有奖试读&征文:我们在互联网上奋斗的故事
</font></a>
&nbsp;&nbsp;&nbsp;&nbsp;

<a href="http://blog.csdn.net/blogdevteam/article/details/39894901">
<font color=red>参与话题讨论，好礼等你拿
</font></a>
&nbsp;&nbsp;&nbsp;&nbsp;

<a href="http://www.csdn.net/article/2014-10-22/2822245-weixin-devday-shenzhen">
<font color=blue>深圳微信开发者大会不容错过的十大理由
</font></a>


</div>                        </div>
                        

  
<link href="http://static.blog.csdn.net/css/comment1.css" type="text/css" rel="stylesheet" />
<link href="http://static.blog.csdn.net/css/style1.css" type="text/css" rel="stylesheet" />
<script language='JavaScript' type='text/javascript' src='http://download.csdn.net/js/jquery.cookie.js'></script>
<script type="text/javascript" src="http://csdnimg.cn/rabbit/search-service/main.js"></script>
<div id="article_details" class="details">
    <div class="article_title">   
         <span class="ico ico_type_Repost"></span>


    <h1>
        <span class="link_title"><a href="/qiqll/article/details/7971574">
        __sync_fetch_and_add系列的命令
        </a></span>
    </h1>
</div>

    <div class="article_manage">
        <span class="link_categories">
        分类：
            <a href="/qiqll/article/category/744033" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_fenlei']);">c++</a> 
        </span>
    <span class="link_postdate">2012-09-12 16:12</span>
    <span class="link_view" title="阅读次数">9418人阅读</span>
    <span class="link_comments" title="评论次数"><a href="#comments" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_pinglun'])">评论</a>(0)</span>
    <span class="link_collect"><a href="javascript:void(0);" onclick="javascript:_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shoucang']);collectArticle('__sync_fetch_and_add系列的命令','7971574');return false;" title="收藏">收藏</a></span>
    <span class="link_report"><a href="#report"  onclick="javascript:_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_jubao']);report(7971574,2);return false;" title="举报">举报</a></span>
    
</div>
<div class="tag2box"><a href='http://www.csdn.net/tag/variables' target=_blank onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_tag']);">variables</a><a href='http://www.csdn.net/tag/%e5%a4%9a%e7%ba%bf%e7%a8%8b' target=_blank onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_tag']);">多线程</a><a href='http://www.csdn.net/tag/access' target=_blank onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_tag']);">access</a><a href='http://www.csdn.net/tag/gcc' target=_blank onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_tag']);">gcc</a></div>

  
    
<div id="article_content" class="article_content">

__sync_fetch_and_add系列的命令，发现这个系列命令讲的最好的一篇文章，英文好的同学可以直接去看原文。Multithreaded simple data type access and atomic variables
<p>&nbsp;&nbsp;&nbsp;&nbsp; __sync_fetch_and_add系列一共有十二个函数，有加/减/与/或/异或/等函数的原子性操作函数,__sync_fetch_and_add,顾名思义，现fetch，然后自加，返回的是自加以前的&#20540;。以count = 4为例，调用__sync_fetch_and_add(&amp;count,1),之后，返回&#20540;是4，然后，count变成了5.<br>
&nbsp;&nbsp;&nbsp; 有__sync_fetch_and_add,自然也就有__sync_add_and_fetch，呵呵这个的意思就很清楚了，先自加，在返回。他们哥俩的关系与i&#43;&#43;和&#43;&#43;i的关系是一样的。被谭浩强他老人家收过保护费的都会清楚了。<br>
&nbsp;&nbsp;&nbsp; 有了这个宝贝函数，我们就有新的解决办法了。对于多线程对全局变量进行自加，我们就再也不用理线程锁了。下面这行代码，和上面被pthread_mutex保护的那行代码作用是一样的，而且也是线程安全的。</p>
<p>__sync_fetch_and_add( &amp;global_int, 1 );<br>
&nbsp;&nbsp;&nbsp; 下面是这群函数的全家福，大家看名字就知道是这些函数是干啥的了。</p>
<p><span style="font-size:18px; color:#ff0000">在用gcc编译的时候要加上选项 -march=i686</span><br>
type __sync_fetch_and_add (type *ptr, type value);<br>
type __sync_fetch_and_sub (type *ptr, type value);<br>
type __sync_fetch_and_or (type *ptr, type value);<br>
type __sync_fetch_and_and (type *ptr, type value);<br>
type __sync_fetch_and_xor (type *ptr, type value);<br>
type __sync_fetch_and_nand (type *ptr, type value);<br>
type __sync_add_and_fetch (type *ptr, type value);<br>
type __sync_sub_and_fetch (type *ptr, type value);<br>
type __sync_or_and_fetch (type *ptr, type value);<br>
type __sync_and_and_fetch (type *ptr, type value);<br>
type __sync_xor_and_fetch (type *ptr, type value);<br>
type __sync_nand_and_fetch (type *ptr, type value);</p>
<p>&nbsp;</p>
<p><span style="color:#0000ff">bool</span><span style="color:#000000">&nbsp;__sync_bool_compare_and_swap&nbsp;(type&nbsp;</span><span style="color:#000000">*</span><span style="color:#000000">ptr,&nbsp;type&nbsp;oldval&nbsp;type&nbsp;newval,&nbsp;...)<br>
type&nbsp;__sync_val_compare_and_swap&nbsp;(type&nbsp;</span><span style="color:#000000">*</span><span style="color:#000000">ptr,&nbsp;type&nbsp;oldval&nbsp;type&nbsp;newval,&nbsp;...)</span><br>
<br>
这两个函数提供原子的比较和交换，如果*ptr == oldval,就将newval写入*ptr,<br>
第一个函数在相等并写入的情况下返回true.<br>
第二个函数在返回操作之前的&#20540;。<br>
<br>
<span style="color:#000000">__sync_synchronize&nbsp;(...)</span><br>
发出一个full barrier.<br>
<br>
关于memory barrier,cpu会对我们的指令进行排序，一般说来会提高程序的效率，但有时候可能造成我们不希望得到的结果，举一个例子，比如我们有一个硬件设备，它有4个寄存器，当你发出一个操作指令的时候，一个寄存器存的是你的操作指令（比如READ），两个寄存器存的是参数（比如是地址和size），最后一个寄存器是控制寄存器，在所有的参数都设置好之后向其发出指令，设备开始读取参数，执行命令，程序可能如下：<br>
</p>
<div class="cnblogs_code">
<div>&nbsp;</div>
<div>write1(dev.register_size,size);<br>
&nbsp;&nbsp;&nbsp;&nbsp;write1(dev.register_addr,addr);<br>
&nbsp;&nbsp;&nbsp;&nbsp;write1(dev.register_cmd,READ);<br>
&nbsp;&nbsp;&nbsp;&nbsp;write1(dev.register_control,GO);<br>
如果最后一条write1被换到了前几条语句之前，那么肯定不是我们所期望的，这时候我们可以在最后一条语句之前加入一个memory barrier,强制cpu执行完前面的写入以后再执行最后一条：</div>
<div>&nbsp;</div>
<div>write1(dev.register_size,size);<br>
&nbsp;&nbsp;&nbsp;&nbsp;write1(dev.register_addr,addr);<br>
&nbsp;&nbsp;&nbsp;&nbsp;write1(dev.register_cmd,READ);<br>
&nbsp;&nbsp;&nbsp;&nbsp;__sync_synchronize();<br>
&nbsp;&nbsp;&nbsp;&nbsp;write1(dev.register_control,GO);<br>
<br>
memory barrier有几种类型：<br>
&nbsp;&nbsp;&nbsp; acquire barrier : 不允许将barrier之后的内存读取指令移到barrier之前（linux kernel中的wmb()）。<br>
&nbsp;&nbsp;&nbsp; release barrier : 不允许将barrier之前的内存读取指令移到barrier之后 (linux kernel中的rmb())。<br>
&nbsp;&nbsp;&nbsp; full barrier&nbsp;&nbsp;&nbsp; : 以上两种barrier的合集(linux kernel中的mb())。<br>
<br>
<br>
还有两个函数：<br>
<br>
type __sync_lock_test_and_set (type *ptr, type value, ...)<br>
&nbsp;&nbsp; 将*ptr设为value并返回*ptr操作之前的&#20540;。<br>
<br>
void __sync_lock_release (type *ptr, ...)<br>
&nbsp;&nbsp;&nbsp;&nbsp; 将*ptr置0</div>
<div><br>
<br>
&nbsp;</div>
<div class="cnblogs_code">
<div></div>
</div>
</div>

</div>




<!-- Baidu Button BEGIN -->

<div class="bdsharebuttonbox" style="float: right;">
<a href="#" class="bds_more" data-cmd="more" style="background-position:0 0 !important; background-image: url(http://bdimg.share.baidu.com/static/api/img/share/icons_0_16.png?v=d754dcc0.png) !important"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"  style="background-position:0 -52px !important"></a>
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"style="background-position:0 -104px !important"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"style="background-position:0 -260px !important"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"style="background-position:0 -208px !important"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"style="background-position:0 -1612px !important" ></a>
</div>
<script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "1", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
<!-- Baidu Button END -->

<!--192.168.100.35-->
<ul class="article_next_prev">
            <li class="prev_article"><span  onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian']);location.href='/qiqll/article/details/7970503';">上一篇</span><a href="/qiqll/article/details/7970503" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian'])">实现一个lockfree 的队列</a></li>
            <li class="next_article"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian']);location.href='/qiqll/article/details/7990525';">下一篇</span><a href="/qiqll/article/details/7990525" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian'])">从linux shell命令行输出中取得数据以及jwsmtp使用实例</a></li>
</ul>

<!-- Baidu Button BEGIN -->
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=1536434" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
    document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!-- Baidu Button END -->


</div>
      <dl class="blog-associat-tag">
        <dt>主题推荐</dt>
        <dd>
                <a href="http://www.csdn.net/tag/全局变量" target="_blank" class="blog-tage-red" >全局变量</a> 
                <a href="http://www.csdn.net/tag/线程安全" target="_blank" class="blog-tage-red" >线程安全</a> 
                <a href="http://www.csdn.net/tag/多线程" target="_blank" class="blog-tage-red" >多线程</a> 
                <a href="http://www.csdn.net/tag/内存" target="_blank" class="blog-tage-red" >内存</a> 
                <a href="http://www.csdn.net/tag/access" target="_blank" class="blog-tage-red" >access</a> 
        </dd>
    </dl> 


<dl class="blog-ass-articl tracking-ad"  data-mod="popu_36" id="res-relatived"> 
     <dt><span>猜你在找</span></dt>    
</dl>

<script type="text/javascript">
    var searchtitletags = '__sync_fetch_and_add系列的命令' + ',' + '全局变量,线程安全,多线程,内存,access';
    searchService({
        index: 'blog',
        query: searchtitletags,
        from: 10,
        size: 10,
        appendTo: '#res-relatived',
        url: 'recommend',
        his: 2,
        client: "blog_cf_enhance",
        tmpl: '<dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="#{ url }" title="#{ title }" strategy="#{ strategy }">#{ title }</a></dd>'
    });

 </script>   


    <div id="ad_cen">
   
          <script type="text/javascript">
              new Ad(4, 'ad_cen');
          </script>
    </div>
<div class="comment_class">
    <div id="comment_title" class="panel_head">
        <span class="see_comment">查看评论</span><a name="comments"></a></div>
    <div id="comment_list">
    </div>
    <div id="comment_bar">
    </div>
    <div id="comment_form">
    </div>

    <div class="announce">
        * 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场<a name="reply"></a><a name="quote"></a></div>
</div>

<script type="text/javascript">
    var fileName = '7971574';
    var commentscount = 0;
    var islock = false
</script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/comment.js"></script>
    <div id="ad_bot">
    </div>
    <script type="text/javascript">
    new Ad(5, 'ad_bot');
    </script>
<div id="report_dialog">
</div>

<div id="d-top"  style="bottom:60px;">
        <a id="quick-reply" class="btn btn-top q-reply" title="快速回复" style="display:none;">
            <img src="http://static.blog.csdn.net/images/blog-icon-reply.png" alt="快速回复">
        </a>    

    <a id="d-top-a" class="btn btn-top backtop"  style="display: none;" title="返回顶部" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_huidaodingbu'])" style="">         
         <img src="http://static.blog.csdn.net/images/top.png" alt="TOP">
    </a>
</div>
<script type="text/javascript">
    $(function ()
    {
        $("#ad_frm_0").height("90px");
        
        setTimeout(function(){
            $("#ad_frm_2").height("200px");
        },1000);
        

        if($("#comment_content").length>0)
        {
            $("#quick-reply").show();

            $("#quick-reply").click(function(){
                setEditorFocus();
            });
        }       
     
        var d_top = $('#d-top-a');
        document.onscroll = function ()
        {
            var scrTop = (document.body.scrollTop || document.documentElement.scrollTop);
            if (scrTop > 500)
            {
                d_top.show();
            } else
            {
                d_top.hide();
            }
        }
        $('#d-top-a').click(function ()
        {
            scrollTo(0, 0);
            this.blur();
            return false;
        });
    });
  
</script>
<style type="text/css">
    .tag_list
    {
        background: none repeat scroll 0 0 #FFFFFF;
        border: 1px solid #D7CBC1;
        color: #000000;
        font-size: 12px;
        line-height: 20px;
        list-style: none outside none;
        margin: 10px 2% 0 1%;
        padding: 1px;
    }
    .tag_list h5
    {
        background: none repeat scroll 0 0 #E0DBD3;
        color: #47381C;
        font-size: 12px;
        height: 24px;
        line-height: 24px;
        padding: 0 5px;
        margin: 0;
    }
    .tag_list h5 a
    {
        color: #47381C;
    }
    .classify
    {
        margin: 10px 0;
        padding: 4px 12px 8px;
    }
    .classify a
    {
        margin-right: 20px;
        white-space: nowrap;
    }
</style>
<div class="tag_list">
    <h5>
        <a href="http://www.csdn.net/tag/" target="_blank">核心技术类目</a></h5>
    <div class="classify">
<a title="全部主题" href="http://www.csdn.net/tag" target="_blank" onclick="LogClickCount(this,336);">全部主题</a>
<a title="Hadoop" href="http://g.csdn.net/5272865" target="_blank" onclick="LogClickCount(this,336);">Hadoop</a>
<a title="AWS" href="http://g.csdn.net/5272866" target="_blank" onclick="LogClickCount(this,336);">AWS</a>
<a title="移动游戏" href="http://g.csdn.net/5272870" target="_blank" onclick="LogClickCount(this,336);">移动游戏</a>
<a title="Java" href="http://g.csdn.net/5272871" target="_blank" onclick="LogClickCount(this,336);">Java</a>
<a title="Android" href="http://g.csdn.net/5272872" target="_blank" onclick="LogClickCount(this,336);">Android</a>
<a title="iOS" href="http://g.csdn.net/5272873" target="_blank" onclick="LogClickCount(this,336);">iOS</a>
<a title="Swift" href="http://g.csdn.net/5272868" target="_blank" onclick="LogClickCount(this,336);">Swift</a>
<a title="智能硬件" href="http://g.csdn.net/5272869" target="_blank" onclick="LogClickCount(this,336);">智能硬件</a>
<a title="Docker" href="http://g.csdn.net/5272867" target="_blank" onclick="LogClickCount(this,336);">Docker</a>
<a title="OpenStack" href="http://g.csdn.net/5272925" target="_blank" onclick="LogClickCount(this,336);">OpenStack</a>
<a title="VPN" href="http://www.csdn.net/tag/vpn" target="_blank" onclick="LogClickCount(this,336);">VPN</a>
<a title="Spark" href="http://g.csdn.net/5272924" target="_blank" onclick="LogClickCount(this,336);">Spark</a>
<a title="ERP" href="http://www.csdn.net/tag/erp" target="_blank" onclick="LogClickCount(this,336);">ERP</a>
<a title="IE10" href="http://www.csdn.net/tag/ie10" target="_blank" onclick="LogClickCount(this,336);">IE10</a>
<a title="Eclipse" href="http://www.csdn.net/tag/eclipse" target="_blank" onclick="LogClickCount(this,336);">Eclipse</a>
<a title="CRM" href="http://www.csdn.net/tag/crm" target="_blank" onclick="LogClickCount(this,336);">CRM</a>
<a title="JavaScript" href="http://www.csdn.net/tag/javascript" target="_blank" onclick="LogClickCount(this,336);">JavaScript</a>
<a title="数据库" href="http://www.csdn.net/tag/数据库" target="_blank" onclick="LogClickCount(this,336);">数据库</a>
<a title="Ubuntu" href="http://www.csdn.net/tag/ubuntu" target="_blank" onclick="LogClickCount(this,336);">Ubuntu</a>
<a title="NFC" href="http://www.csdn.net/tag/nfc" target="_blank" onclick="LogClickCount(this,336);">NFC</a>
<a title="WAP" href="http://www.csdn.net/tag/wap" target="_blank" onclick="LogClickCount(this,336);">WAP</a>
<a title="jQuery" href="http://www.csdn.net/tag/jquery" target="_blank" onclick="LogClickCount(this,336);">jQuery</a>
<a title="BI" href="http://www.csdn.net/tag/bi" target="_blank" onclick="LogClickCount(this,336);">BI</a>
<a title="HTML5" href="http://www.csdn.net/tag/html5" target="_blank" onclick="LogClickCount(this,336);">HTML5</a>
<a title="Spring" href="http://www.csdn.net/tag/spring" target="_blank" onclick="LogClickCount(this,336);">Spring</a>
<a title="Apache" href="http://www.csdn.net/tag/apache" target="_blank" onclick="LogClickCount(this,336);">Apache</a>
<a title=".NET" href="http://www.csdn.net/tag/.net" target="_blank" onclick="LogClickCount(this,336);">.NET</a>
<a title="API" href="http://www.csdn.net/tag/api" target="_blank" onclick="LogClickCount(this,336);">API</a>
<a title="HTML" href="http://www.csdn.net/tag/html" target="_blank" onclick="LogClickCount(this,336);">HTML</a>
<a title="SDK" href="http://www.csdn.net/tag/sdk" target="_blank" onclick="LogClickCount(this,336);">SDK</a>
<a title="IIS" href="http://www.csdn.net/tag/iis" target="_blank" onclick="LogClickCount(this,336);">IIS</a>
<a title="Fedora" href="http://www.csdn.net/tag/fedora" target="_blank" onclick="LogClickCount(this,336);">Fedora</a>
<a title="XML" href="http://www.csdn.net/tag/xml" target="_blank" onclick="LogClickCount(this,336);">XML</a>
<a title="LBS" href="http://www.csdn.net/tag/lbs" target="_blank" onclick="LogClickCount(this,336);">LBS</a>
<a title="Unity" href="http://www.csdn.net/tag/unity" target="_blank" onclick="LogClickCount(this,336);">Unity</a>
<a title="Splashtop" href="http://www.csdn.net/tag/splashtop" target="_blank" onclick="LogClickCount(this,336);">Splashtop</a>
<a title="UML" href="http://www.csdn.net/tag/uml" target="_blank" onclick="LogClickCount(this,336);">UML</a>
<a title="components" href="http://www.csdn.net/tag/components" target="_blank" onclick="LogClickCount(this,336);">components</a>
<a title="Windows Mobile" href="http://www.csdn.net/tag/windowsmobile" target="_blank" onclick="LogClickCount(this,336);">Windows Mobile</a>
<a title="Rails" href="http://www.csdn.net/tag/rails" target="_blank" onclick="LogClickCount(this,336);">Rails</a>
<a title="QEMU" href="http://www.csdn.net/tag/qemu" target="_blank" onclick="LogClickCount(this,336);">QEMU</a>
<a title="KDE" href="http://www.csdn.net/tag/kde" target="_blank" onclick="LogClickCount(this,336);">KDE</a>
<a title="Cassandra" href="http://www.csdn.net/tag/cassandra" target="_blank" onclick="LogClickCount(this,336);">Cassandra</a>
<a title="CloudStack" href="http://www.csdn.net/tag/cloudstack" target="_blank" onclick="LogClickCount(this,336);">CloudStack</a>
<a title="FTC" href="http://www.csdn.net/tag/ftc" target="_blank" onclick="LogClickCount(this,336);">FTC</a>
<a title="coremail" href="http://www.csdn.net/tag/coremail" target="_blank" onclick="LogClickCount(this,336);">coremail</a>
<a title="OPhone " href="http://www.csdn.net/tag/ophone " target="_blank" onclick="LogClickCount(this,336);">OPhone </a>
<a title="CouchBase" href="http://www.csdn.net/tag/couchbase" target="_blank" onclick="LogClickCount(this,336);">CouchBase</a>
<a title="云计算" href="http://www.csdn.net/tag/云计算" target="_blank" onclick="LogClickCount(this,336);">云计算</a>
<a title="iOS6" href="http://www.csdn.net/tag/iOS6" target="_blank" onclick="LogClickCount(this,336);">iOS6</a>
<a title="Rackspace " href="http://www.csdn.net/tag/rackspace " target="_blank" onclick="LogClickCount(this,336);">Rackspace </a>
<a title="Web App" href="http://www.csdn.net/tag/webapp" target="_blank" onclick="LogClickCount(this,336);">Web App</a>
<a title="SpringSide" href="http://www.csdn.net/tag/springside" target="_blank" onclick="LogClickCount(this,336);">SpringSide</a>
<a title="Maemo" href="http://www.csdn.net/tag/maemo" target="_blank" onclick="LogClickCount(this,336);">Maemo</a>
<a title="Compuware" href="http://www.csdn.net/tag/compuware" target="_blank" onclick="LogClickCount(this,336);">Compuware</a>
<a title="大数据" href="http://www.csdn.net/tag/大数据" target="_blank" onclick="LogClickCount(this,336);">大数据</a>
<a title="aptech" href="http://www.csdn.net/tag/aptech" target="_blank" onclick="LogClickCount(this,336);">aptech</a>
<a title="Perl" href="http://www.csdn.net/tag/perl" target="_blank" onclick="LogClickCount(this,336);">Perl</a>
<a title="Tornado" href="http://www.csdn.net/tag/tornado" target="_blank" onclick="LogClickCount(this,336);">Tornado</a>
<a title="Ruby" href="http://www.csdn.net/tag/ruby" target="_blank" onclick="LogClickCount(this,336);">Ruby</a>
<a title="Hibernate" href="http://www.csdn.net/hibernate" target="_blank" onclick="LogClickCount(this,336);">Hibernate</a>
<a title="ThinkPHP" href="http://www.csdn.net/tag/thinkphp" target="_blank" onclick="LogClickCount(this,336);">ThinkPHP</a>
<a title="HBase" href="http://www.csdn.net/tag/hbase" target="_blank" onclick="LogClickCount(this,336);">HBase</a>
<a title="Pure" href="http://www.csdn.net/tag/pure" target="_blank" onclick="LogClickCount(this,336);">Pure</a>
<a title="Solr" href="http://www.csdn.net/tag/solr" target="_blank" onclick="LogClickCount(this,336);">Solr</a>
<a title="Angular" href="http://www.csdn.net/tag/angular" target="_blank" onclick="LogClickCount(this,336);">Angular</a>
<a title="Cloud Foundry" href="http://www.csdn.net/tag/cloudfoundry" target="_blank" onclick="LogClickCount(this,336);">Cloud Foundry</a>
<a title="Redis" href="http://www.csdn.net/tag/redis" target="_blank" onclick="LogClickCount(this,336);">Redis</a>
<a title="Scala" href="http://www.csdn.net/tag/scala" target="_blank" onclick="LogClickCount(this,336);">Scala</a>
<a title="Django" href="http://www.csdn.net/tag/django" target="_blank" onclick="LogClickCount(this,336);">Django</a>
<a title="Bootstrap" href="http://www.csdn.net/tag/bootstrap" target="_blank" onclick="LogClickCount(this,336);">Bootstrap</a>
    </div>
</div>


                        <div class="clear">
                        </div>
                    </div>                   
                
            </div>
            <div id="side">
    <div class="side">
<div id="panel_Profile" class="panel">
<ul class="panel_head"><span>个人资料</span></ul>
<ul class="panel_body profile">
<div id="blog_userface">
    <a href="http://my.csdn.net/qiqll" target="_blank">
    <img src="http://avatar.csdn.net/F/1/7/1_qiqll.jpg" title="访问我的空间" style="max-width:90%"/>
    </a>
    <br />
    <span><a href="http://my.csdn.net/qiqll" class="user_name" target="_blank">qiqll</a></span>
</div>
<div class="interact">
<a href="javascript:void(0);" class="attent" id="span_add_follow" title="[加关注]" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_guanzhu'])"></a>

 <a href="javascript:void(0);" class="letter"  title="[发私信]" onclick="window.open('http://msg.csdn.net/letters/model?receiver=qiqll','_blank','height=350,width=700');_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_sixin'])"></a>  
</div>
<div id="blog_medal">
                <div id="bms_box">
               </div>
</div>
<ul id="blog_rank">
    <li>访问：<span>18160次</span></li>
    <li>积分：<span>354</span> </li>    
    <li >等级： <span style="position:relative;display:inline-block;z-index:1" >
            <img src="http://csdnimg.cn/jifen/images/xunzhang/jianzhang/blog2.png" alt="" style="vertical-align: middle;" id="leveImg">
            <div id="smallTittle" style=" position: absolute;  left: -24px;  top: 25px;  text-align: center;  width: 101px;  height: 32px;  background-color: #fff;  line-height: 32px;  border: 2px #DDDDDD solid;  box-shadow: 0px 2px 2px rgba (0,0,0,0.1);  display: none;   z-index: 999;">
            <div style="left: 42%;  top: -8px;  position: absolute;  width: 0;  height: 0;  border-left: 10px solid transparent;  border-right: 10px solid transparent;  border-bottom: 8px solid #EAEAEA;"></div>
            积分：354 </div>
        </span>  </li>
    <li>排名：<span>千里之外</span></li>
</ul>
<ul id="blog_statistics">
    <li>原创：<span>18篇</span></li>
    <li>转载：<span>13篇</span></li>
    <li>译文：<span>0篇</span></li>
    <li>评论：<span>2条</span></li>
</ul>
</ul>
</div>


<div class="panel" id="panel_Search">
    <ul class="panel_head"><span>文章搜索</span></ul>
    <ul class="panel_body">
        <form id="frmSearch" action="http://so.csdn.net/search" class="form_search" target="_blank">
        <span><input id="inputSearch" type="text" class="blogsearch" title="请输入关键字" /></span>
        <input id="btnSubmit" type="button" value="搜索" title="search in blog" />
        <input type="hidden" name="q" id="inputQ" />
        <input type="hidden" name="t" value="blog" />
        <a id="btnSearchBlog" target="_blank"></a>
        </form>
    </ul>
</div>

<script type="text/javascript">
    $(function () {
        $("#btnSubmit").click(function () {           
            search();
        });

        $("#frmSearch").submit(function () {
            search();
            return false;
        });

        function search()
        {
            var url = "http://so.csdn.net/so/search/s.do?q=" + encodeURIComponent($("#inputSearch").val()) + "&u=" + username + "&t=blog";
            window.location.href = url;
        }   
    });
</script>
<div id="panel_Category" class="panel">
<ul class="panel_head"><span>文章分类</span></ul>
<ul class="panel_body">
             <li>
                <a href="http://blog.csdn.net/qiqll/article/category/744033" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">c++</a><span>(13)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qiqll/article/category/796085" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">工作心得</a><span>(9)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qiqll/article/category/796084" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">排序算法</a><span>(2)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qiqll/article/category/746283" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">读书</a><span>(4)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qiqll/article/category/744054" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">通信</a><span>(1)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qiqll/article/category/1343334" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">glibc源码阅读</a><span>(3)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qiqll/article/category/1868555" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">python</a><span>(3)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qiqll/article/category/2415225" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">推荐算法</a><span>(1)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qiqll/article/category/2430665" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">hadoop</a><span>(1)</span>
            </li>
</ul>
</div><div id="panel_Archive" class="panel">
<ul class="panel_head"><span>文章存档</span></ul>
<ul class="panel_body">
<div id="archive_list">
<!--归档统计-->
<li><a href="http://blog.csdn.net/qiqll/article/month/2014/10">2014年10月</a><span>(2)</span></li><li><a href="http://blog.csdn.net/qiqll/article/month/2014/09">2014年09月</a><span>(3)</span></li><li><a href="http://blog.csdn.net/qiqll/article/month/2014/07">2014年07月</a><span>(3)</span></li><li><a href="http://blog.csdn.net/qiqll/article/month/2014/01">2014年01月</a><span>(1)</span></li><li><a href="http://blog.csdn.net/qiqll/article/month/2013/02">2013年02月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/qiqll/article/month/2012/09">2012年09月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/qiqll/article/month/2012/08">2012年08月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/qiqll/article/month/2011/04">2011年04月</a><span>(1)</span></li><li><a href="http://blog.csdn.net/qiqll/article/month/2011/03">2011年03月</a><span>(2)</span></li><li><a href="http://blog.csdn.net/qiqll/article/month/2010/10">2010年10月</a><span>(5)</span></li><li><a href="http://blog.csdn.net/qiqll/article/month/2010/07">2010年07月</a><span>(2)</span></li>
</div>
</ul>
</div>
<div id="hotarticls" class="panel">
<ul class="panel_head">
    <span>       
阅读排行    </span>
</ul>

<ul class="panel_body itemlist">
<li>
<a href="/qiqll/article/details/7971574" title="__sync_fetch_and_add系列的命令">__sync_fetch_and_add系列的命令</a><span>(9396)</span>
</li>
<li>
<a href="/qiqll/article/details/5950697" title="C++跨平台开发心得小结">C++跨平台开发心得小结</a><span>(787)</span>
</li>
<li>
<a href="/qiqll/article/details/7890730" title="字符集GBK和UTF8的区别说明">字符集GBK和UTF8的区别说明</a><span>(776)</span>
</li>
<li>
<a href="/qiqll/article/details/7990525" title="从linux shell命令行输出中取得数据以及jwsmtp使用实例">从linux shell命令行输出中取得数据以及jwsmtp使用实例</a><span>(675)</span>
</li>
<li>
<a href="/qiqll/article/details/6248511" title="平衡二叉树">平衡二叉树</a><span>(590)</span>
</li>
<li>
<a href="/qiqll/article/details/7970503" title="实现一个lockfree 的队列">实现一个lockfree 的队列</a><span>(566)</span>
</li>
<li>
<a href="/qiqll/article/details/7996442" title="实现一个lockfree的队列——错误修改">实现一个lockfree的队列——错误修改</a><span>(362)</span>
</li>
<li>
<a href="/qiqll/article/details/7895827" title="指定长度的strstr函数">指定长度的strstr函数</a><span>(362)</span>
</li>
<li>
<a href="/qiqll/article/details/5716748" title="转载：：学习C/C++编程，Linux平台的优势与劣势">转载：：学习C/C++编程，Linux平台的优势与劣势</a><span>(276)</span>
</li>
<li>
<a href="/qiqll/article/details/7922823" title="典型 PC 系统各种操作指令的大概时间">典型 PC 系统各种操作指令的大概时间</a><span>(270)</span>
</li>
</ul>
</div>
<div id="hotarticls2" class="panel">
<ul class="panel_head"><span>评论排行</span></ul>
<ul class="panel_body itemlist">
<li>
<a href="/qiqll/article/details/5709859" title="【转】C++各大明库介绍">【转】C++各大明库介绍</a><span>(1)</span>
</li>
<li>
<a href="/qiqll/article/details/7990525" title="从linux shell命令行输出中取得数据以及jwsmtp使用实例">从linux shell命令行输出中取得数据以及jwsmtp使用实例</a><span>(1)</span>
</li>
<li>
<a href="/qiqll/article/details/39478825" title="pycharm是一个很棒的python语言ide">pycharm是一个很棒的python语言ide</a><span>(0)</span>
</li>
<li>
<a href="/qiqll/article/details/7996442" title="实现一个lockfree的队列——错误修改">实现一个lockfree的队列——错误修改</a><span>(0)</span>
</li>
<li>
<a href="/qiqll/article/details/8574419" title="垂直搜索采集系统总结（上）">垂直搜索采集系统总结（上）</a><span>(0)</span>
</li>
<li>
<a href="/qiqll/article/details/8574574" title="glibc2.16.0阅读笔记">glibc2.16.0阅读笔记</a><span>(0)</span>
</li>
<li>
<a href="/qiqll/article/details/8588408" title="c++宏定义中 #，#@，##的用法">c++宏定义中 #，#@，##的用法</a><span>(0)</span>
</li>
<li>
<a href="/qiqll/article/details/8595017" title="ptmalloc分配器的分析">ptmalloc分配器的分析</a><span>(0)</span>
</li>
<li>
<a href="/qiqll/article/details/18603441" title="第一个python程序">第一个python程序</a><span>(0)</span>
</li>
<li>
<a href="/qiqll/article/details/40047221" title="setjmp和longjmp函数">setjmp和longjmp函数</a><span>(0)</span>
</li>
</ul>
</div>
<div id="homepageArticles" class="panel tracking-ad" data-mod="popu_4">
<ul class="panel_head"><span>推荐文章</span></ul>
<ul class="panel_body" id="ad_commend"></ul>
</div>
<script type="text/javascript">
 new Ad(12, 'ad_commend');
</script><div id="newcomments" class="panel">
<ul class="panel_head"><span>最新评论</span></ul>
<ul class="panel_body itemlist">
    <li>
   
         <a href="/qiqll/article/details/7990525#comments">从linux shell命令行输出中取得数据以及jwsmtp使用实例</a>
    <p style="margin:0px;"><a href="/wjian20" class="user_name">wjian20</a>:
你好，我在make jwsmtp的时候报错，不知道怎么解决？
    </p>
    </li>
    <li>
   
         <a href="/qiqll/article/details/5709859#comments">【转】C++各大明库介绍</a>
    <p style="margin:0px;"><a href="/yli5891" class="user_name">yli5891</a>:
长见识了
    </p>
    </li>
</ul>
</div>
    </div>
    <div class="clear">
    </div>
</div>

            <div class="clear">
            </div>
        </div>
        

<script type="text/javascript" src="http://csdnimg.cn/rabbit/cnick/cnick.js"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/newblog.min.js"></script>


<script type="text/javascript" src="http://medal.blog.csdn.net/showblogmedal.ashx?blogid=878406"></script>
<script type="text/javascript">
    document.write('<script type="text/javascript" src="http://csdnimg.cn/pubfooter/js/publib_footer.js?' + Math.floor(new Date() / 120000).toString(36) + '="></' + 'script>');
</script>
    <script type="text/javascript" src="http://passport.csdn.net/content/loginbox/login.js"></script>
<script type="text/javascript">document.write("<img src=http://counter.csdn.net/pv.aspx?id=24 border=0 width=0 height=0>");</script>
<script type="text/javascript" src="http://www.csdn.net/ui/scripts/Csdn/counter.js"></script>
<script type="text/javascript" src="http://ad.csdn.net/scripts/ad-blog.js"></script>
<script type="text/javascript" src="http://zz.csdn.net/js/count.js"></script>
<script type="text/javascript">
    $(function () {
        function __get_code_toolbar(snippet_id) {
            return $("<a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "' target='_blank' title='在CODE上查看代码片' style='text-indent:0;'><img src='https://code.csdn.net/assets/CODE_ico.png' width=12 height=12 alt='在CODE上查看代码片' style='position:relative;top:1px;left:2px;'/></a>"
                    + "<a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "/fork' target='_blank' title='派生到我的代码片'  style='text-indent:0;'><img src='https://code.csdn.net/assets/ico_fork.svg' width=12 height=12 alt='派生到我的代码片' style='position:relative;top:2px;left:2px;'/></a>");
        }
        
        $("[code_snippet_id]").each(function () {
            __s_id = $(this).attr("code_snippet_id");
            if (__s_id != null && __s_id != "" && __s_id != 0 && parseInt(__s_id) > 70020) {
                __code_tool = __get_code_toolbar(__s_id);
                $(this).prev().find(".tools").append(__code_tool);
            }
        });
    });
</script>

    </div>
      <!--new top-->
    
    <script id="csdn-toolbar-id" btnId="header_notice_num" wrapId="note1" count="5" subCount="5" type="text/javascript" src="http://static.csdn.net/public/common/toolbar/js/toolbar.js"></script>     <!--new top-->
</body>
</html>
